package stream._02createstreamoperation;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class CreateStreamTest {
    //创建流的三种方式

    @Test
    public void maTest1() {
        //1.由集合类中的stream方法创建
        ArrayList<String> list = new ArrayList<>();
        Stream<String> stream = list.stream();
    }

    public void myTest2() {
        //2.由Stream类中的of方法来创建
        Stream<String> stream2 = Stream.of("aa","bb","cc");
    }

    public void myTest3() {
        //3.由数组工具类Arrays中的Stream方法来创建

        int[] arr = {1,2,3,4};
        IntStream stream = Arrays.stream(arr);

        String[] strs = {"aa","bb","cc"};
        Stream<String> stream1 = Arrays.stream(strs);


    }
}
